<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <link href="./static/plugins/bootstrap/bootstrap.min.css" rel="stylesheet">
    <link href="./static/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
    <link href="./static/css/font-awesome.min.css" rel="stylesheet">
    <link href="./static/plugins/toastr/toastr.min.css" rel="stylesheet">
    <link href="./static/plugins/blueimp/blueimp-gallery.min.css" rel="stylesheet">
    <link href="./static/plugins/ladda/ladda-themeless.min.css" rel="stylesheet">
    <link href="./static/css/animate.css" rel="stylesheet">
    <link href="./static/css/style.css" rel="stylesheet">

    <script type="text/javascript" src="./static/js/jquery-3.1.1.min.js"></script>
    <script type="text/javascript" src="./static/plugins/bootstrap/bootstrap.min.js"></script>
</head>
<body class="fixed-sidebar no-skin-config full-height-layout">
<div id="wrapper" v-cloak>
    <nav class="navbar-default navbar-static-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav metismenu" id="side-menu">
                <li class="nav-header">
                    <div class="dropdown profile-element">
                        <span class="img-thumb"><strong class="font-bold">{{user.company}}</strong></span>
                        <a href="javascript:">
                            <span class="clear">
                                <span class="block m-t-xs"> <strong class="font-bold">{{type[user.type]}}</strong></span>
                            </span>
                        </a>
                    </div>
                </li>
                <li class="active">
                    <a href="/home.html"><i class="fa fa-home"></i> <span class="nav-label">个人中心</span></a>
                </li>
                <li>
                    <a href="#"><i class="fa fa-info-circle"></i> <span class="nav-label">基本信息</span><span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level collapse">
                        <li><a href="user.html">个人信息</a></li>
                        <li><a href="verify.html">账号认证</a></li>
                        <li><a href="finance.html">财务明细</a></li>
                        <li v-if="user.is_root>0"><a href="employee.html">员工账号</a></li>
                        <li><a href="pwd.html">修改密码</a></li>
                        <li><a href="address.html">收货地址</a></li>
                    </ul>
                </li>
                <li v-if="user.type!=2">
                    <a href="#"><i class="fa fa-th-large"></i> <span class="nav-label">询价</span> <span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level collapse">
                        <li><a href="inquiry_list.html">询价单</a></li>
                        <li><a href="enquiry.html">我要询价</a></li>
                    </ul>
                </li>
                <li v-else>
                    <a href="#"><i class="fa fa-th-large"></i> <span class="nav-label">报价</span> <span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level collapse">
                        <li><a href="inquiry_list_supply.html">未报价</a></li>
                        <li><a href="offer_sheet.html">已报价</a></li>
                    </ul>
                </li>
                <li>
                    <a href="index.html"><i class="fa fa-first-order"></i> <span class="nav-label">订单管理</span> <span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level collapse">
                        <li><a href="order_list.html">订单列表</a></li>

                    </ul>
                </li>
                <li>
                    <a onclick="logout()"><i class="fa fa-sign-out"></i> <span class="nav-label">退出登录</span></a>
                </li>
            </ul>
        </div>
    </nav>
    <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom">
            <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                <div class="navbar-header">
                    <a class="navbar-minimalize minimalize-styl-2 btn btn-success" href="#"><i class="fa fa-bars"></i> </a>
                </div>
                <ul class="nav navbar-top-links navbar-right">
                    <li class="m-r">
                        <span class="m-r-sm text-danger font-bold welcome-message" id="nav-title">{{user.name}}&nbsp;</span><span>{{user.company}}&nbsp;{{user.zone}}</span>
                    </li>

                    <li class="dropdown m-r">
                        <a class="dropdown-toggle count-info" data-toggle="dropdown" href="#" aria-expanded="false">
                            <i class="fa fa-bell"></i> <span class="label label-danger" v-if="msgbox.total">{{msgbox.total}}</span>
                        </a>
                        <ul class="dropdown-menu dropdown-alerts">
                            <li v-if="msgbox.daifahuo">
                                <a href="javascript:parent.document.getElementById('main').src='order_list.html?order_status=200'">
                                    <div>
                                        <i class="fa fa-envelope fa-fw"></i> 您有<strong>{{msgbox.daifahuo}}</strong>个待发货订单
                                    </div>
                                </a>
                            </li>
                            <li class="divider" v-if="msgbox.daifahuo"></li>
                            <li v-if="msgbox.daifukuan">
                                <a href="javascript:parent.document.getElementById('main').src='order_list.html?order_status=100'">
                                    <div>
                                        <i class="fa fa-twitter fa-fw"></i> 您有<strong>{{msgbox.daifukuan}}</strong>个待付款订单
                                    </div>
                                </a>
                            </li>
                            <li class="divider" v-if="msgbox.daifukuan"></li>
                            <li v-if="msgbox.daishouhuo">
                                <a href="javascript:parent.document.getElementById('main').src='order_list.html?order_status=300'">
                                    <div>
                                        <i class="fa fa-twitter fa-fw"></i> 您有<strong>{{msgbox.daishouhuo}}</strong>个订单待收货
                                    </div>
                                </a>
                            </li>
                            <li class="divider" v-if="msgbox.daishouhuo"></li>
                            <li v-if="msgbox.baojiazhong && user.type==1">
                                <a href="javascript:parent.document.getElementById('main').src='inquiry_list.html?status=100'">
                                    <div>
                                        <i class="fa fa-twitter fa-fw"></i> 您有<strong>{{msgbox.baojiazhong}}</strong>个报价中询价单
                                    </div>
                                </a>
                            </li>
                            <li class="divider" v-if="msgbox.baojiazhong && user.type==1"></li>
                            <li v-if="msgbox.daibaojia">
                                <a href="javascript:parent.document.getElementById('main').src='inquiry_list_supply.html'">
                                    <div>
                                        <i class="fa fa-twitter fa-fw"></i> 您有<strong>{{msgbox.daibaojia}}</strong>个待报价询价单
                                    </div>
                                </a>
                            </li>
                            <li class="divider" v-if="msgbox.daibaojia"></li>
                            <li v-if="msgbox.weitongguo">
                                <a href="javascript:parent.document.getElementById('main').src='offer_sheet.html'">
                                    <div>
                                        <i class="fa fa-twitter fa-fw"></i> 您有<strong>{{msgbox.weitongguo}}</strong>个报价未通过
                                    </div>
                                </a>
                            </li>
                        </ul>
                    </li>

                    <li>
                        <a onclick="logout()">
                            <i class="fa fa-sign-out"></i> 安全退出
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
        <div class="row wrapper border-bottom white-bg p-h-sm">
            <div class="col-lg-10">
                <ol class="breadcrumb">
                    <li class="active">
                        <strong>个人中心</strong>
                    </li>
                </ol>
            </div>
        </div>

        <div class="wrapper wrapper-content animated fadeInRight tooltip-demo">
            <div class="row m-b-lg m-t-lg">
                <div class="col-md-6">
                    <div class="profile-image">
                        <img :src="[company.logo || 'https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/vue/vue.png']" class="img-circle circle-border m-b-md">
                    </div>
                    <div class="profile-info">
                        <div>
                            <h2 class="no-margins">{{company.name}}&nbsp;<small>{{user.zone}}</small>&nbsp;【{{type[user.type]}}】</h2>
                            <h4 :class="['badge',{'badge-warning':company.authstatus==2}]">{{status[company.authstatus]}}</h4>
                            <h4>{{user.phone}}</h4>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-6">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <span class="label label-primary"><i class="fa fa-shopping-cart"></i></span><h5> &nbsp;&nbsp;待办事项</h5>
                            <div class="ibox-tools">
                                <a class="collapse-link">
                                    <i class="fa fa-chevron-up"></i>
                                </a>
                                <a class="close-link">
                                    <i class="fa fa-times"></i>
                                </a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <div class="flex" v-if="user.type!=2">
                                <a class="sumary text-center text-muted" href="inquiry_list.html">
                                    <h3>询价中 (待报价)</h3>
                                    <div class="">
                                        <span class="text-danger">{{msgbox.daifahuo}}</span> 单
                                    </div>
                                </a>
                                <a class="sumary text-center text-muted m-l-lg" href="order_list.html?orders_filter[order_status]=100">
                                    <h3>待付款</h3>
                                    <div class="">
                                        <span class="text-danger">{{msgbox.daifukuan}}</span> 单
                                    </div>
                                </a>
                                <a class="sumary text-center text-muted m-l-lg" href="order_list.html?orders_filter[order_status]=300">
                                    <h3>待收货</h3>
                                    <div class="">
                                        <span class="text-danger">{{msgbox.daishouhuo}}</span> 单
                                    </div>
                                </a>
                            </div>
                            <div class="flex" v-else>
                                <a class="sumary text-center text-muted" href="inquiry_list_supply.html">
                                    <h3>待报价</h3>
                                    <div class="">
                                        <span class="text-danger">{{msgbox.daibaojia}}</span> 单
                                    </div>
                                </a>
                                <a class="sumary text-center text-muted m-l-lg" href="order_list.html?orders_filter[order_status]=200">
                                    <h3>待发货</h3>
                                    <div class="">
                                        <span class="text-danger">{{msgbox.daifahuo}}</span> 单
                                    </div>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="./static/plugins/toastr/toastr.min.js"></script>
<script type="text/javascript" src="./static/plugins/validate/jquery.validate.min.js"></script>
<script type="text/javascript" src="./static/plugins/ladda/spin.min.js"></script>
<script type="text/javascript" src="./static/plugins/ladda/ladda.min.js"></script>
<script type="text/javascript" src="./static/plugins/ladda/ladda.jquery.min.js"></script>
<script type="text/javascript" src="./static/js/slimscroll.min.js"></script>
<script type="text/javascript" src="./static/js/metisMenu.js"></script>
<script type="text/javascript" src="./static/js/inspinia.js"></script>
<script type="text/javascript" src="./static/js/vue.min.js"></script>
<script type="text/javascript" src="./static/js/main.js"></script>
<script>
    var vm = new Vue({
        el: '#wrapper',
        data: {
            user: {},
            msgbox: {},
            company: {},
            status: ['未提交', '待认证', '认证通过', '认证失败'],
            type: {"1": "修理厂", "2": "配件商", "3": "保险公司"}
        },
        methods: {
            getData: function (instance) {
                $.ajax({
                    type: 'POST',
                    url: api + 'user/home',
                    success: function (data) {
                        checkToken(data);
                        instance.company = data.data.company;
                        instance.user.company_id = data.data.company_id;
                        instance.user.company = data.data.company.name;
                        instance.user.avatar = data.data.avatar;
                        instance.user.id = data.data.id;
                        instance.user.is_root = data.data.is_root;
                        instance.user.name = data.data.name;
                        instance.user.phone = data.data.phone;
                        instance.user.type = data.data.type;
                        instance.user.zone = data.data.company.zone;
                        instance.user.logined_at = data.data.logined_at;
                        instance.user.gender = data.data.gender;
                        setItem('info', instance.user);
                    },
                });
            }
        },
        created: function () {
            this.getData(this);
            this.user = getItem('info');
            var self = this;
            $.ajax({
                type: 'POST',
                url: api + 'user/msgNum',
                dataType: 'json',
                success: function (data) {
                    if (data.ret == 0) {
                        self.msgbox = data.data;
                    }
                },
            });
        }
    });

</script>
</body>
</html>
